package com.dhcc.activemq.producer;

import javax.jms.Topic;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.jms.core.JmsMessagingTemplate;
import org.springframework.stereotype.Component;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

/**
* <p>标题: TopicProducer.java</p>
* <p>业务描述:topic发送</p>
* <p>公司:东华软件股份公司</p>
* <p>版权:dhcc2013</p>
* @author 胡凯
* @date 2019年7月29日
* @version V1.0 
*/
@RestController
@RequestMapping("/topic")
//@Component
public class TopicProducer {
    @Autowired
    private JmsMessagingTemplate jmsMessagingTemplate;
    @Autowired
	private Topic topic;
    
	@RequestMapping("/send")
	public void sendByTopic(String msg) {
		// 指定消息发送的目的地及内容
		System.out.println("@@@@@@@@@@@@@@" + msg);
		this.jmsMessagingTemplate.convertAndSend(this.topic, msg);
	}
}
